/**
 * Created by weikexin .
 * description:
 **/
import { HTTP } from '../util/http'

class Job extends HTTP {
  recruitList (params={}, success) {
    let url = 'RecruitManagement/queryRecruitManagementPage'
    let data = Object.assign({},
       params,
        {
        count: 10,
        rnd: 666
    })
    this.request({
      url: url,
      method: 'POST',
      urlData: data,
      success
    })
  }

  recruitPublish (params={}, success, fail) {
    let url = 'RecruitManagement/save'
    let data = Object.assign({},
      params,
    {
    })
    this.request({
      url: url,
      method: 'POST',
      data: data,
      urlData: {
        userId: wx.getStorageSync('userInfo').user_id || 0
      },
      success,
      fail
    })
  }

  recruitUpdate (params={}, success, fail) {
    let url = 'RecruitManagement/updateById'
    let data = Object.assign({},
      params,
    {
    })
    this.request({
      url: url,
      method: 'POST',
      data: data,
      urlData: {
        userId: wx.getStorageSync('userInfo').user_id || 0
      },
      success,
      fail
    })
  }

  category ( success) {
    let url = 'job/category'
    let data = {
      rnd: 666
    }
    this.request({
      url: url,
      data: data,
      success
    })
  }

  categoryV2 ( success) {
    let url = 'v2/job/category'
    let data = {
      rnd: 666
    }
    this.request({
      url: url,
      data: data,
      success
    })
  }

  detail (params, success) {
    let url = 'RecruitManagement/queryDetailById'
    let data =  Object.assign({},
      params,
      {
        userId: wx.getStorageSync('userInfo').user_id || 0
    })
    this.request({
      url: url,
      data: data,
      success
    })
  }

  delete(params, success, fail) {
    let url = 'RecruitManagement/deleteById'
    let data = Object.assign({},
        params,
        {})
    this.request({
        method: 'POST',
        url: url,
        urlData: data,
        success,
        fail
    })
  }


  resumePublish (params={}, success) {
    let url = 'job/resume'
    let data = Object.assign({},
      params,
      {
      })
    this.request({
      url: url,
      method: 'POST',
      data: data,
      urlData: {
        rnd: wx.getStorageSync('userInfo').user_id || 0
      },
      success
    })
  }
}

export { Job }
